<?php
namespace app\api\controller;

use library\Controller;
use think\facade\Config;
use think\Db;

class Queue extends Controller{
	
	//更改订单逾期状态（每天执行一次）
    public function overdue_change()
    {  	
        set_time_limit(0);
		$today = date('Y-m-d',time());
		
    	//更新逾期预警状态
    	$list = Db::name('system_order')->where(['is_deleted'=>0,'overdue_status'=>1,'overdue_warning_at'=>$today])->update(['overdue_status'=>2]);
    	//更新逾期状态
    	$list = Db::name('system_order')->where(['is_deleted'=>0,'overdue_status'=>2,'overdue_at'=>$today])->update(['overdue_status'=>3]);
    	
    	//更新核对图超期状态
    	$list = Db::name('system_order')->where(['is_deleted'=>0,'checkpic_status'=>2,'checkpic_warning_at'=>$today])->update(['checkpic_status'=>3]);
    	//更新发邮箱状态
    	$list = Db::name('system_order')->where(['is_deleted'=>0,'checkpic_status'=>4,'email_warning_at'=>$today])->update(['checkpic_status'=>5]);
    	
    	//删除导出表格产生的本地图片
    	delImgs('/public/upload/excelimgs/');
        
    }
    
}